package com.googlecode.cswish.struts.conversion;

import org.apache.struts2.components.Checkbox;

import com.googlecode.cswish.model.PageElement;
import com.googlecode.cswish.model.PropertyInfo;

public class BooleanElementConverter extends CommonElementConverter {

	@Override
	public PageElement convert(ConversionContext context) {
		PropertyInfo propertyInfo = context.getPropertyInfo();

		PageElement element = super.convert(context);
		
		String type = Checkbox.class.getName();
		element.setShortName(propertyInfo.getName());
		// list, listValue,
		element.setType(type);
		element.addExtraParams("fieldValue", "1");
		return element;
	}
}